"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
async function rename(filePath, newFilePath) {
    return new Promise((resolve, reject) => {
        if (fs_1.default.existsSync(newFilePath)) {
            resolve(['文件已存在', false]);
        }
        else {
            fs_1.default.promises.rename(filePath, newFilePath).then(() => {
                resolve([null, true]);
            }).catch((err) => {
                resolve([err, false]);
            });
        }
    });
}
exports.default = rename;
